home *** CD-ROM | disk | FTP | other *** search
/ Champak 122 / Vol 122.iso / games / sketchbo.swf / scripts / DefineSprite_303 / frame_1 / DoAction.as
Encoding:
Text File  |  2011-01-06  |  540 b   |  34 lines

  1. if(!init)
  2. {
  3.    init = true;
  4.    gotoAndStop("still");
  5.    count = 0;
  6. }
  7. this.onEnterFrame = function()
  8. {
  9.    _X = _X - _root.hitomi.speed;
  10.    if(this.hitTest(_hitomi.hitarea))
  11.    {
  12.       beenHit();
  13.    }
  14. };
  15. beenHit = function()
  16. {
  17.    this.count = this.count + 1;
  18.    if(random(2) == 0)
  19.    {
  20.       var c = random(3) + 1;
  21.       var candle = eval("lamp.c" + c);
  22.       candle.gotoAndStop("off");
  23.    }
  24.    if(random(3) == 0)
  25.    {
  26.       gotoAndPlay(1);
  27.    }
  28.    else
  29.    {
  30.       gotoAndStop("still");
  31.       play();
  32.    }
  33. };
  34.